// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   BibleBook.java

package presenter;

import java.util.ArrayList;

// Referenced classes of package presenter:
//            SongVerse

public class BibleBook
{

    public BibleBook(String bookName)
    {
        this.bookName = bookName;
        verses = new ArrayList();
    }

    public void addVerse(int chapter, int verse, String text[])
    {
        if(chapter > this.chapter)
            verses.add(new ArrayList());
        for(int i = 0; i < text.length; i++);
        SongVerse sv = new SongVerse();
        sv.setText(text);
        sv.setType((new StringBuilder()).append(bookName).append(" ").append(chapter).append(":").append(verse).toString());
        ((ArrayList)verses.get(chapter - 1)).add(sv);
        this.chapter = chapter;
        this.verse = verse;
    }

    public SongVerse[] getVerses(int chapterStart, int verseStart, int chapterEnd, int verseEnd)
    {
        ArrayList result = new ArrayList();
        ArrayList chapter = (ArrayList)verses.get(chapterStart);
        if(chapterStart == chapterEnd)
        {
            for(int i = verseStart; i <= verseEnd; i++)
                result.add(chapter.get(i));

            return (SongVerse[])result.toArray(new SongVerse[verseEnd + 1]);
        }
        for(int i = verseStart; i < chapter.size(); i++)
            result.add(chapter.get(i));

        for(int i = chapterStart + 1; i < chapterEnd; i++)
        {
            chapter = (ArrayList)verses.get(i);
            for(int j = 0; j < chapter.size(); j++)
                result.add(chapter.get(j));

        }

        chapter = (ArrayList)verses.get(chapterEnd);
        for(int i = 0; i <= verseEnd; i++)
            result.add(chapter.get(i));

        return (SongVerse[])result.toArray(new SongVerse[1]);
    }

    public int getNumberOfChapters()
    {
        return verses.size();
    }

    public int getNumberOfVerses(int chapter)
    {
        return ((ArrayList)verses.get(chapter)).size();
    }

    public String getName()
    {
        return bookName;
    }

    private String bookName;
    private ArrayList verses;
    private int chapter;
    private int verse;
}
